Wait 15 seconds for the listener port, not 100 - #116
Merged
Conversation
BINDTRIES and BINDWAIT shipped with HTTPD's defaults of 10 and 10, which was consistency taken as its own justification. HTTPD's number predates a stale port sweep: there, a repeated bind is the only defence against a port a dead instance still holds. Here close_stale_port() has already cleared that case before the retry loop is reached (#109), so what still answers EADDRINUSE afterwards is most likely a LIVE foreign listener -- and waiting on one does not help, because it does not go away. What waiting costs changed too. Before #111 a failed bind left the STC sitting there and the budget was spent by nobody; now it ends the address space, so the operator who typed /S and is watching the console waits out the whole thing for a verdict that was decided in the first few seconds. 3 x 5 covers TIME_WAIT and a tight restart, and a failed start is recognisable as one while someone is still looking at it. The case that genuinely wants more patience is EADDRNOTAVAIL early in an IPL -- a different order of magnitude from EADDRINUSE, and what raising BINDTRIES is for. Sample member and installation guide say so. Measured on mvsdev from the built-in defaults, with no BINDTRIES or BINDWAIT in the config member at all: 04.15.26 FTPD051E BIND() FAILED ON 10.99.99.99 PORT 2122, ERRNO=49 04.15.26 FTPD051I RETRYING BIND IN 5S (1 OF 3) 04.15.31 FTPD051I RETRYING BIND IN 5S (2 OF 3) 04.15.36 FTPD051I RETRYING BIND IN 5S (3 OF 3) 04.15.41 FTPD051E BIND() STILL FAILING AFTER 3 TRIES, ERRNO=49 04.15.41 FTPD056E FTPD IS NOT LISTENING ON PORT 2122, THIS INSTANCE ENDS IEF142I FTPDT FTPDT - STEP WAS EXECUTED - COND CODE 0008 Claude-Session: https://claude.ai/code/session_01A6q4hLaokSJBeifJDkNJtH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BINDTRIESandBINDWAITshipped in #114 with HTTPD's defaults of 10 and 10.That was consistency taken as its own justification, and it does not survive
looking at what FTPD actually retries.
Why 100 seconds is the wrong number here
HTTPD's number predates a stale port sweep. There, a repeated bind is the
only defence against a port a dead instance still holds. Here
close_stale_port()has already cleared that case before the retry loop isreached (#109) — so whatever still answers
EADDRINUSEafterwards is mostlikely a live foreign listener, and waiting on one does not help, because it
does not go away.
What waiting costs changed too. Before #111 a failed bind left the STC
sitting there idle and the budget was spent by nobody. Now it ends the address
space — so the operator who typed
/Sand is watching the console waits out thewhole thing for a verdict that was decided in the first few seconds.
The two retryable errnos want opposite time constants.
EADDRNOTAVAILearlyin an IPL may want far more than 100 seconds;
EADDRINUSEafter the sweep wantsfar less. One shared budget at 100 serves neither well. 3 × 5 serves the common
case, and the IPL case is what raising
BINDTRIESis for — which is the wholepoint of the knob, and the sample member and installation guide say so.
Verified on mvsdev
Throwaway STC, config member deliberately carrying no
BINDTRIESorBINDWAITline, so the built-in defaults are what gets exercised:15 seconds start to verdict.
make test-host78/78,tools/check-module-data.pyclean, both changed sources compiled by hand with-Wall -Werror.Test STC proc and config data set deleted afterwards; port 2122 refuses
connections and the live FTPD on 2121 answers normally.
Version
Stays a patch. The whole reason for revisiting the number is that the released
behaviour (one retry, 10s) is closer to 3 × 5 than to 10 × 10 — so 1.0.1 does not
have to defend a large default change, and
TFTP100is not spent.